import java.util.Scanner;

/*
    整数反转
 */
public class IntegerInversion {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long n = 0;
        while (x != 0) {
            n = n * 10 + x % 10;
            x = x / 10;
        }
        System.out.println((int) n == n ? (int) n : 0);

    }
}
